package com.yanmaohu.nikita.data.function;

import com.yanmaohu.nikita.data.function.statement.Statement;

import java.util.List;

/**
 * @author Birght Lee
 */
public final class FunctionBody {

    private int beginIndex;
    private int endIndex;
    private List<Statement> statementList;

    public FunctionBody(int beginIndex, int endIndex, List<Statement> statementList) {
        this.beginIndex = beginIndex;
        this.endIndex = endIndex;
        this.statementList = statementList;
    }

    public int getBeginIndex() {
        return beginIndex;
    }

    public int getEndIndex() {
        return endIndex;
    }

    public boolean isEmpty() {
        if (statementList == null) {
            return true;
        }
        return statementList.isEmpty();
    }

    public int size() {
        if (statementList == null) {
            return 0;
        }
        return statementList.size();
    }

    public Statement get(int index) {
        return statementList.get(index);
    }

}
